import request from '@/utils/axios/axios-service.ts'
//商户列表
export const merchantList = (params: any) => request.get('/v1/merchant',{params: params})
//商户详情
export const merchantInfo = (params: any) => request.get('/v1/merchant',{params: params})
//所属区域
export const cityTree= (params: any) => request.get('/v1/city',{params: params})
//mcc大类
export const mccBigType = (params: any) => request.get('/v1/mcc',{params: params})
//mcc小类
export const mccSmallType = (params: any) => request.get('/v1/mcc',{params: params})
//新增商户
export const merchantSave = (data:any,params: any) => request.post('/v1/merchant', data, {params: params})
//编辑商户
export const merchantUpdate = (data:any,params: any) => request.put('/v1/merchant', data, {params: params})
//删除商户
export const merchantDelete = (params: any) => request.delete('/v1/merchant',{params: params})
//商户进件列表
export const merchantEntryList = (params: any) => request.get('/v1/entry',{params: params})
//商户进件
export const merchantEntry = (data:any,params: any) => request.post('/v1/entry',data,{params: params})
//商户进件校验
export const merchantEntryInfo = (params: any) => request.get('/v1/entry',{params: params})
//商户进件详情
export const merchantEntryDetail = (params: any) => request.get('/v1/entry',{params: params})
//商户进件编辑
export const merchantEntryUpdate = (data:any,params: any) => request.put('/v1/entry',data,{params: params})
//白名单 列表
export const whiteList = (params: any) => request.get('/v1/white',{params: params})
//白名单 新增
export const whiteAdd = (data:any,params: any) => request.post('/v1/white',data,{params: params})
//白名单 编辑
export const whiteEdit = (data:any,params: any) => request.put('/v1/white',data,{params: params})
//白名单 删除
export const whiteDelete = (params: any) => request.delete('/v1/white',{params: params})
//白名单 查询
export const whiteInfo = (params: any) => request.get('/v1/white',{params: params})
//产品
// export const PRODUCTList = (params: any) => request.get('/v1/product',{params: params})

/**
 * 店铺接口
 */
export const storeList = (params: any) => request.get('/store/info/list', {params: params})
export const storeInfo = (id: number) => request.get('/store/info/info/' + id)
export const storeSaveOrUpdate = (params: any, isCreate: boolean) => request.post(isCreate ? '/store/info/create' : '/store/info/update', params)
export const storeAudit = (params: any) => request.post('/store/info/audit', params)
export const storeStatusUpdate = (params: any) => request.post('/store/info/update_status', params)
export const storeSimpleList = (params: any) => request.get('/store/info/simple_list', {params: params})
export const storeUpdateRecommend = (params: any) => request.post('/store/info/update_recommend' , params);
export const storeUpdateHeepayMerchId = (params: any) => request.post('/store/info/update_heepay_merch_id', params);
export const storeEntrySubmit = (id: number) => request.post('/store/info/entry_submit/' + id);
export const storeEntryQuery = (id: number) => request.post('/store/info/entry_query/' + id);
export const storeEntryComplete = (id: number) => request.post('/store/info/entry_complete/' + id);
export const storeConfig = () => request.get('/store/info/config');

/**
 * 店铺分类相关接口
 */
export const storeCateTreeList = (showDefault?: boolean) => request.get('/store/category/tree_list', {params: {showDefault: showDefault}})
export const storeCateInfo = (id: number) => request.get('/store/category/info/' + id)
export const storeCateSaveOrUpdate = (params: any, isCreate: boolean) => request.post(isCreate ? '/store/category/create' : '/store/category/update', params)
export const storeCateSimpleList = (parentId: number, showDefault: boolean) => request.get('/store/category/simple_list', {params: {parent_id: parentId, showDefault: showDefault}})

/**
 * 店铺产品
 */
export const storeProductList = (params: any) => request.get('/store/product/list', {params: params})
export const storeProductInfo = (id: number) => request.get('/store/product/info/' + id)
export const storeProductSaveOrUpdate = (params: any, isCreate: boolean) => request.post(isCreate ? '/store/product/create' : '/store/product/update', params)

/**
 * 连锁店接口
 */
export const storeChainList = (params: any) => request.get('/store/chain/list', {params: params})
export const storeChainInfo = (id: number) => request.get('/store/chain/info/' + id)
export const storeChainSaveOrUpdate = (params: any, isCreate: boolean) => request.post(isCreate ? '/store/chain/create' : '/store/chain/update', params)
export const storeChainAll = () => request.get('/store/chain/all')

/**
 * 店铺订单接口
 */
export const storeOrderList = (params: any) => request.get('/store/order/list', {params: params})

/**
 * 门店自定义公排区域
 */
export const storeAllianceList = (params: any) => request.get('/store/alliance/list', {params: params})
export const storeAllianceInfo = (id: number) => request.get('/store/alliance/info/' + id)
export const storeAllianceSaveOrUpdate = (params: any, isCreate: boolean) => request.post(isCreate ? '/store/alliance/create' : '/store/alliance/update', params)

/**
 * 门店播报设备
 */
export const storeVoiceDeviceList = (params: any) => request.get('/store/voice_device/list', {params: params})
export const storeVoiceDeviceInfo = (id: number) => request.get('/store/voice_device/info/' + id)
export const storeVoiceDeviceSaveOrUpdate = (params: any, isCreate: boolean) => request.post(isCreate ? '/store/voice_device/create' : '/store/voice_device/update', params)


export type StoreProductData = {
  id: number;
  store_id: number;
  status: number;
  name: string;
  cover_url: string;
  price: number;
  price_cost: number;
  audit_time: string;
  audit_opinion: string;
  order_num: number;
};

export type StoreChain = {
  id: number;
  name: string;
  public_status: number; // 公排状态 0:开启 1:关闭
  public_queue_type: number; // 公排类型 0:全国 1:省排 2:市排 3:区排 10:自定义
  public_queue_code?: number; // 自定义编码
  subsidy_config_id: number; // 补贴配置编号
  rebate_ratio: number; // 让利比例
  subsidy_ratio: number; // 补贴比例
  promotion_ratio: number; // 推广奖金比例
  service_fee_ratio: number; // 联盟服务费
};

export type StoreAlliance = {
  id: number;
  name: string;
  code: number;
  remark: string;
  managers: string;
};

export type StoreManager = {
  uid: number;
  account: string;
};

export type StoreVoiceDevice = {
  id: number; // 编号
  store_id: number; // 门店编号
  name: string; // 名称
  device_no: string; // 设备号
  status: number; // 状态 0:开启 1:关闭
};
